﻿@model  IEnumerable<WebSoftSeo.Models.Blog>


@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutSubscribe.cshtml";
    int counts = ViewBag.count;
    int count = counts / 2;
    if (counts % 2 != 0)
    {
        count = count + 1;
    }
}
<style>
    .giveMeEllipsis
    {
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3; /* number of lines to show */
        line-height: 2; /* fallback */
        max-height: 100px; /* fallback */
    }
</style>
<!-- Content Blog -->
        <div class="wrapBlogContent">
        	<div class="container">
            	<!-- blogContentL -->
            	<div class="blogContentL">
                    @if(Model != null)
                    {
                        foreach(var item in Model)
                        {
                            DateTime dt = (DateTime)item.DateCreate;
                            string date = dt.ToString("HH:mm    dd/MM/yyyy");
                	<div class="col1">
                    	<h4><a href="@Url.RouteUrl("Blog", new {title = WebSoftSeo.Utility.HelperSEO.ToSeoUrl(item.Title), id = item.ID })">@item.Title </a></h4>
                        <p class="namedate">By <b>@item.User.FullName</b> @date</p>
                        <div class="testBlog">
                        	<img class="img-responsive" src="~/Images/Blog/@item.ImagePath">
                            <p>
                            	@Html.Raw(item.ShortDescription)
                            </p>
                        </div>
                        <div class="social">
                        	<a href="@Url.Content("~/Blog/Detail/?id="+item.ID)">Xem thêm</a>
                            <div class="divSocial"><img src="~/data/h2.jpg"></div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                    }
                    }
                    
                   
                   
                     @{
                int pagenew = 0;
                if (Request["page"] != null)
                {
                    pagenew = Convert.ToInt32(Request["page"]);
                }

            }

           @* <div class="clearfix"></div>*@
            <div class="prev-next">
                <ul>
                    <li><a href="@Url.Content("~/Blog/Index/?page=" + ((pagenew - 1) < 1 ? pagenew : (pagenew - 1)))">
                        <p>Previous</p>
                    </a></li>
                    @for (int i = 1; i <= count; i++)
                    {
                        if (Request["page"] != null && Convert.ToInt32(Request["Page"]) == i)
                        {
                        <li><a class="active" href="@Url.Content("~/Blog/Index/?page=" + i)">@i</a></li>
                        }
                        else
                        {
                             <li><a href="@Url.Content("~/Blog/Index/?page=" + i)">@i</a></li>
                        }
                    }


                    <li><a href="@Url.Content("~/Blog/Index/?page=" + ((pagenew + 1) > count ? pagenew : (pagenew + 1)))">Next</a></li>
                </ul>
                <div class="clearfix"></div>
            </div>
                </div>
                <!-- End blogContentL -->
                <!-- blogContentR -->
            	<div class="blogContentR">
                   <p class="createBlog"> @Html.ActionLink("Viết Blog", "Create", "Blog")</p>
                	@{Html.RenderAction("_BlogCategory", "Blog");}
                   @{Html.RenderAction("_PopularBlogArticle", "Blog");}
                    <div class="clearfix"></div>
                    <h2 class="h1Sibar">Lưu trữ (chọn tháng)</h2>
                   @{Html.RenderAction("_MonthFilter", "Blog");}
                </div>
                <!-- End blogContentR -->
                <div class="clearfix"></div>
            </div>
        </div>
